package com.example.courseapp;

import android.content.Context;
import android.content.SharedPreferences;


public class SharedPreferencesHelper {
    private static final String PREFS_NAME = "MyPreferences";
    private static final String KEY_DATA = "data";

    public static void saveName(Context context,String key, String string) {
        SharedPreferences sharedPreferences = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = sharedPreferences.edit();

        editor.putString(key, string);
        editor.apply();
    }

    public static String getName(Context context,String key) {
        SharedPreferences sharedPreferences = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);

        return sharedPreferences.getString(key, "");
    }
}
